.underline modifier underlines text with different colors.
Syntax
.underline()
.underline(true, color: Color.red)
Example
struct ContentView: View {
var body: some View {
VStack {
Text("Normal").font(.largeTitle)
Text("Underline").font(.largeTitle)
.underline(true, color: Color.red)
}
}
}
Output